package net.hn.hnms.biz.cockpit.controller;


import cn.hutool.json.JSONObject;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import net.hn.hnms.biz.cockpit.domain.vo.OptionVo;
import net.hn.hnms.biz.cockpit.service.IDispatchCockpitService;
import net.hn.hnms.sys.common.core.domain.R;
import net.hn.hnms.sys.common.satoken.config.AutoSetMineCode;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@Api(value = "调度驾驶舱", tags = {"调度驾驶舱"})
@RestController
@RequestMapping("/cockpit/dispatch")
@RequiredArgsConstructor
public class DispatchCockpitController {


    private final IDispatchCockpitService dispatchCockpitService;

    @ApiOperation("日产量趋势")
    @GetMapping("/product")
    @AutoSetMineCode
    public R<JSONObject> getProductTrend(String mineCode) {
        return R.ok(dispatchCockpitService.getProductTrend(mineCode));
    }

    @ApiOperation("日进尺趋势")
    @GetMapping("/distance")
    @AutoSetMineCode
    public R<JSONObject> getDistanceTrend(String mineCode) {
        return R.ok(dispatchCockpitService.getDistanceTrend(mineCode));
    }


    @ApiOperation(value = "产量对比",notes = "type:month 月, year 年")
    @GetMapping("/outputCorrelation")
    @AutoSetMineCode
    public R<JSONObject> getOutputCorrelation(String mineCode, @RequestParam("type")String type) {
        return R.ok(dispatchCockpitService.getOutputCorrelation(mineCode,type));
    }

    @ApiOperation(value = "进尺对比",notes = "type:month 月, year 年")
    @GetMapping("/distanceCorrelation")
    @AutoSetMineCode
    public R<JSONObject> getDistanceCorrelation(String mineCode, @RequestParam("type")String type) {
        return R.ok(dispatchCockpitService.getDistanceCorrelation(mineCode,type));
    }



    @ApiOperation("工作面总产量")
    @GetMapping("/workFaceOutput")
    @AutoSetMineCode
    public R<List<OptionVo>> getWorkFaceOutput(String mineCode) {
        return R.ok(dispatchCockpitService.getWorkFaceOutput(mineCode));
    }

    @ApiOperation("矿领导值班")
    @GetMapping("/mineLeader")
    @AutoSetMineCode
    public R<List<String>> mineLeader(String mineCode) {
        return R.ok(dispatchCockpitService.getMineLeader(mineCode));
    }

    

}
